package edu.sctu.nieyu.day20150628exam.deal;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * Created by user01 on 2015/6/28.
 */

/**
 * D盘中文件及文档创建类
 */
public class FileUtil {

    public static void createFile(File file){
        if (!file.exists()){
            file.mkdir();
        }
    }
    public static boolean createNewFile(String filename){
        File file = new File(filename);

        if (!file.exists()){
            try {
                return file.createNewFile();

            } catch (IOException e){
                e.printStackTrace();
            }
        }
        return false;
    }

    public static void writeFile(String url){

        try {
            FileOutputStream fileOutputStream = new FileOutputStream(new File("D:/Json/Json.txt"));
            fileOutputStream.write(url.getBytes());
            fileOutputStream.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
